package com.linkgap.cloud.service;

import com.linkgap.cloud.entity.Department;
import com.linkgap.cloud.entity.Member;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CompanyService {

    @Autowired
    private ManagerService managerService;

    @Autowired
    private DepartmentService departmentService;

    @Autowired
    private MemberService memberService;


    public List<Member> queryMemberListByManagerName(String managerName) {
        //1，通过管理者王欢欢姓名查询（tb_manager）王欢欢id
        Long managerId = managerService.queryManagerIdByManagerName(managerName);
        System.out.println("仍然继续执行");
        //2,通过王欢欢id，查询(tb_department)王欢欢id所对应的部门id列表；
        List<Long> departmentIdList = departmentService.queryDepartmentListByManagerId(managerId);
        //3,通过部门id列表，查询（tb_member）所对应的成员列表。
        List<Member> memberList = memberService.queryMemberByDepartmentList(departmentIdList);
        return memberList;


    }
}
